#include <xen/numa.h>
#include <xen/keyhandler.h>
#include <xen/time.h>
-
-#include <asm/numa.h>
+#include <xen/smp.h>
#include <asm/acpi.h>
+static int numa_setup(char *s);
+custom_param("numa", numa_setup);
+
#ifndef Dprintk
#define Dprintk(x...)
#endif
int memnode_shift;
u8 memnodemap[NODEMAPSIZE];
-unsigned int cpu_to_node[NR_CPUS] __read_mostly = {
+unsigned char cpu_to_node[NR_CPUS] __read_mostly = {
[0 ... NR_CPUS-1] = NUMA_NO_NODE
};
unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
nodemask_t node_online_map = { { [0] = 1UL } };
-int numa_off __initdata;
+/* Default NUMA to off for now. acpi=on required to enable it. */
+int numa_off __initdata = 1;
int acpi_numa __initdata;
if (memnodemap[addr >> shift] != 0xff)
return -1;
memnodemap[addr >> shift] = i;
- addr += (1UL << shift);
+ addr += (1UL << shift);
} while (addr < end);
res = 1;
}
}
#ifdef CONFIG_NUMA_EMU
-/* default to faking a single node as fallback for non-NUMA hardware */
-int numa_fake __initdata = 1;
+static int numa_fake __initdata = 0;
/* Numa emulation */
static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
sz = (end_pfn<<PAGE_SHIFT) - nodes[i].start;
nodes[i].end = nodes[i].start + sz;
printk(KERN_INFO "Faking node %d at %"PRIx64"-%"PRIx64" (%"PRIu64"MB)\n",
- i,
- nodes[i].start, nodes[i].end,
- (nodes[i].end - nodes[i].start) >> 20);
+ i,
+ nodes[i].start, nodes[i].end,
+ (nodes[i].end - nodes[i].start) >> 20);
node_set_online(i);
}
memnode_shift = compute_hash_shift(nodes, numa_fake);
{
int i;
+#ifdef CONFIG_NUMA_EMU
+ if (numa_fake && !numa_emulation(start_pfn, end_pfn))
+ return;
+#endif
+
#ifdef CONFIG_ACPI_NUMA
if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT,
end_pfn << PAGE_SHIFT))
- return;
-#endif
-
-#ifdef CONFIG_NUMA_EMU
- /* fake a numa node for non-numa hardware */
- if (numa_fake && !numa_emulation(start_pfn, end_pfn))
- return;
+ return;
#endif
printk(KERN_INFO "%s\n",
printk(KERN_INFO "Faking a node at %016lx-%016lx\n",
start_pfn << PAGE_SHIFT,
end_pfn << PAGE_SHIFT);
- /* setup dummy node covering all memory */
+ /* setup dummy node covering all memory */
memnode_shift = 63;
memnodemap[0] = 0;
nodes_clear(node_online_map);
}
/* [numa=off] */
-__init int numa_setup(char *opt)
+static __init int numa_setup(char *opt)
{
if (!strncmp(opt,"off",3))
numa_off = 1;
+ if (!strncmp(opt,"on",2))
+ numa_off = 0;
#ifdef CONFIG_NUMA_EMU
if(!strncmp(opt, "fake=", 5)) {
+ numa_off = 0;
numa_fake = simple_strtoul(opt+5,NULL,0); ;
if (numa_fake >= MAX_NUMNODES)
numa_fake = MAX_NUMNODES;
}
#endif
#ifdef CONFIG_ACPI_NUMA
- if (!strncmp(opt,"noacpi",6))
- acpi_numa = -1;
+ if (!strncmp(opt,"noacpi",6)) {
+ numa_off = 0;
+ acpi_numa = -1;
+ }
#endif
return 1;
}
#include <asm/desc.h>
#include <asm/shadow.h>
#include <asm/e820.h>
-#include <asm/numa.h>
#include <acm/acm_hooks.h>
extern void dmi_scan_machine(void);
static void parse_acpi_param(char *s);
custom_param("acpi", parse_acpi_param);
-extern int numa_setup(char *s);
-custom_param("numa", numa_setup);
-
/* **** Linux config option: propagated to domain0. */
/* acpi_skip_timer_override: Skip IRQ0 overrides. */
extern int acpi_skip_timer_override;
static void srat_detect_node(int cpu)
{
- unsigned node;
- u8 apicid = x86_cpu_to_apicid[cpu];
+ unsigned node;
+ u8 apicid = x86_cpu_to_apicid[cpu];
- node = apicid_to_node[apicid];
- if (node == NUMA_NO_NODE)
- node = 0;
- numa_set_node(cpu, node);
+ node = apicid_to_node[apicid];
+ if ( node == NUMA_NO_NODE )
+ node = 0;
+ numa_set_node(cpu, node);
- if (acpi_numa > 0)
- printk(KERN_INFO "CPU %d APIC %d -> Node %d\n", cpu, apicid, node);
+ if ( acpi_numa > 0 )
+ printk(KERN_INFO "CPU %d APIC %d -> Node %d\n", cpu, apicid, node);
}
void __init __start_xen(multiboot_info_t *mbi)
if ( !cpu_online(i) )
__cpu_up(i);
- /* setup cpu_to_node[] */
+ /* Set up cpu_to_node[]. */
srat_detect_node(i);
- /* setup node_to_cpumask based on cpu_to_node[] */
+ /* Set up node_to_cpumask based on cpu_to_node[]. */
numa_add_cpu(i);
}
#include <xen/softirq.h>
#include <xen/serial.h>
#include <xen/numa.h>
-#include <asm/numa.h>
#include <asm/current.h>
#include <asm/mc146818rtc.h>
#include <asm/desc.h>
* Adapted for Xen: Ryan Harper <ryanh@us.ibm.com>
*/
-#if 0
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <asm/proto.h>
-#include <xen/bitmap.h>
-#include <xen/numa.h>
-#include <xen/topology.h>
-#include <asm/e820.h>
-#endif
#include <xen/init.h>
#include <xen/mm.h>
#include <xen/inttypes.h>
#include <xen/nodemask.h>
#include <xen/acpi.h>
-
-#include <asm/numa.h>
+#include <xen/numa.h>
#include <asm/page.h>
static struct acpi_table_slit *acpi_slit;
#include <xen/domain_page.h>
#include <xen/keyhandler.h>
#include <xen/perfc.h>
+#include <xen/numa.h>
+#include <xen/nodemask.h>
#include <asm/page.h>
-#include <asm/numa.h>
-#include <asm/topology.h>
/*
* Comma-separated list of hexadecimal page numbers containing bad bytes.
struct domain *d, unsigned int order, unsigned int flags)
{
return __alloc_domheap_pages(d, smp_processor_id(), order, flags);
-
}
-
void free_domheap_pages(struct page_info *pg, unsigned int order)
{
int i, drop_dom_ref;
static inline int acpi_irq_balance_set(char *str) { return 0; }
extern int acpi_scan_nodes(u64 start, u64 end);
extern int acpi_numa;
+#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
#ifdef CONFIG_ACPI_SLEEP
#ifndef _ASM_X8664_NUMA_H
#define _ASM_X8664_NUMA_H 1
-#include <xen/nodemask.h>
-#include <xen/topology.h>
-#include <asm/numnodes.h>
-#include <asm/smp.h>
+#include <xen/cpumask.h>
+
+#define NODES_SHIFT 6
+
+extern unsigned char cpu_to_node[];
+extern cpumask_t node_to_cpumask[];
+
+#define cpu_to_node(cpu) (cpu_to_node[cpu])
+#define parent_node(node) (node)
+#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
+#define node_to_cpumask(node) (node_to_cpumask[node])
struct node {
u64 start,end;
extern int memnode_shift;
extern u8 memnodemap[NODEMAPSIZE];
+struct node_data {
+ unsigned long node_start_pfn;
+ unsigned long node_spanned_pages;
+ unsigned int node_id;
+};
+
extern struct node_data node_data[];
static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
+++ /dev/null
-#ifndef _ASM_MAX_NUMNODES_H
-#define _ASM_MAX_NUMNODES_H
-
-#include <xen/config.h>
-
-#if defined(__i386__)
-#ifdef CONFIG_X86_NUMAQ
-
-/* Max 16 Nodes */
-#define NODES_SHIFT 4
-
-#elif defined(CONFIG_ACPI_SRAT)
-
-/* Max 8 Nodes */
-#define NODES_SHIFT 3
-
-#endif /* CONFIG_X86_NUMAQ */
-
-
-#endif /* __i386__ */
-
-#if defined(CONFIG_NUMA) && defined(__x86_64__)
-#define NODES_SHIFT 6
-#endif /* __x86_64__ */
-
-#endif /* _ASM_MAX_NUMNODES_H */
+++ /dev/null
-/*
- * Copyright (C) 2006, IBM Corp.
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Ryan Harper <ryanh@us.ibm.com>
- */
-
-#ifndef _ASM_X86_TOPOLOGY_H
-#define _ASM_X86_TOPOLOGY_H
-
-#include <xen/config.h>
-#include <xen/bitops.h>
-
-extern cpumask_t cpu_online_map;
-
-extern unsigned int cpu_to_node[];
-extern cpumask_t node_to_cpumask[];
-
-#define cpu_to_node(cpu) (cpu_to_node[cpu])
-#define parent_node(node) (node)
-#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
-#define node_to_cpumask(node) (node_to_cpumask[node])
-
-#endif /* _ASM_X86_TOPOLOGY_H */
* way we do the other calls.
*/
-#if 0
-#include <linux/threads.h>
-#include <asm/bug.h>
-#endif
#include <xen/kernel.h>
#include <xen/bitmap.h>
#include <xen/numa.h>
#define _XEN_NUMA_H
#include <xen/config.h>
-
-#ifdef CONFIG_DISCONTIGMEM
-#include <asm/numnodes.h>
-#endif
+#include <asm/numa.h>
#ifndef NODES_SHIFT
#define NODES_SHIFT 0
#endif
#define MAX_NUMNODES (1 << NODES_SHIFT)
-#define NUMA_NO_NODE 0xff
-
-#define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */
-#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8)
-#define MAX_CHUNKS_PER_NODE 4
-#define MAXCHUNKS (MAX_CHUNKS_PER_NODE * MAX_NUMNODES)
-
-/* needed for drivers/acpi/numa.c */
-#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
-
-extern unsigned int cpu_to_node[];
-#include <xen/cpumask.h>
-extern cpumask_t node_to_cpumask[];
-
-typedef struct node_data {
- unsigned long node_start_pfn;
- unsigned long node_spanned_pages;
- unsigned int node_id;
-} node_data_t;
#endif /* _XEN_NUMA_H */
+++ /dev/null
-/*
- * Copyright (C) 2006, IBM Corp.
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-#ifndef _XEN_TOPOLOGY_H
-#define _XEN_TOPOLOGY_H
-
-#include <asm/topology.h>
-
-#endif /* _XEN_TOPOLOGY_H */